package com.enation.app.javashop.core.client.fallback.distribution;

import com.enation.app.javashop.core.client.feignimpl.distribution.CommissionTplClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.distribution.dos.CommissionTpl;
import org.springframework.stereotype.Component;

/**
 *  模板相关熔断factory
 * @author kingapex
 * @version 1.0
 * @description TODO
 * @data 2022/5/28 14:01
 **/
@Component
public class CommissionTplClientFallbackFactory extends BaseFallbackFactory<CommissionTplClientFeignImpl> {
    @Override
    protected CommissionTplClientFeignImpl fallback() {
        return new CommissionTplClientFallback();
    }

    /**
     * 模板相关熔断
     *
     * @author zh
     * @version v7.0
     * @date 18/9/27 上午8:33
     * @since v7.0
     */
    @Component
    public static class CommissionTplClientFallback implements CommissionTplClientFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public CommissionTpl getDefaultCommission() {
            logger.error("获取默认模板错误");
            return null;
        }
    }
}
